package com.hongdee.base.imp.entity;

import com.hongdee.annotation.ExcelData;
import com.hongdee.base.entity.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Calendar;
import java.util.Map;

/**
 * 名  称:TExcelSchemeProperty
 * 类  型: class
 * 描  述: 用一句话描述类的作用
 * 路  径:com.hongdee.base.imp.entity
 * 作  者:My
 * 日  期:2017/2/15 11:31
 */
@Entity
@Table(name = "T_EXCEL_SCHEME_PROPERTY")
public class TExcelSchemeProperty extends BaseEntity {
    public static final String TABLE = "T_EXCEL_SCHEME_PROPERTY";

    @Column(name = "scheme_Id", length = 32, columnDefinition = " VARCHAR(32) COMMENT '导入方案ID' ")
    private String schemeId;

    @Column(name = "property_Id", length = 32, columnDefinition = " VARCHAR(32) COMMENT '数据实体属性ID' ")
    private String propertyId;

    @ExcelData
    @Column(name = "column_Num", columnDefinition = " integer COMMENT '对应列号，从1开始' ")
    private int columnNum;

    @Column(name = "disp_Index", columnDefinition = " integer COMMENT '排序号' ")
    private int dispIndex;

    @Column(name = "status", columnDefinition = " integer COMMENT '数据状态' ")
    private int status;

    @Column(name = "property_name", columnDefinition = " VARCHAR(64) COMMENT '属性名称' ")
    private String propertyName;

    @Column(name = "property_title", columnDefinition = " VARCHAR(64) COMMENT '属性标题' ")
    private String propertyTitle;

    @Column(name = "is_merge", columnDefinition = " VARCHAR(64) COMMENT '是否行合并单元格' ")
    private String isMerge;

    @Column(name = "field_len", columnDefinition = " VARCHAR(64) COMMENT '字段长度' ")
    private String fieldLen;

    @Column(name = "field_empty", columnDefinition = " VARCHAR(64) COMMENT '是否为空 true 非空 false空' ")
    private String fieldEmpty;

    @Column(name = "field_type", columnDefinition = " VARCHAR(64) COMMENT '字段类别 char字符 date 时间  number数字 ' ")
    private String fieldType;


    public String getFieldLen() {
        return fieldLen;
    }

    public void setFieldLen(String fieldLen) {
        this.fieldLen = fieldLen;
    }

    public String getFieldEmpty() {
        return fieldEmpty;
    }

    public void setFieldEmpty(String fieldEmpty) {
        this.fieldEmpty = fieldEmpty;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public TExcelSchemeProperty() {
        columnNum = 0;
        status = 0;
        setCreateTime(Calendar.getInstance().getTime().getTime());
    }

    public TExcelSchemeProperty(Map dataMap) {
        if (null != dataMap) {
            if (dataMap.containsKey("id")) {
                this.setId((String) dataMap.get("id"));
            }

            if (dataMap.containsKey("schemeId")) {
                this.setSchemeId((String) dataMap.get("schemeId"));
            }

            if (dataMap.containsKey("propertyId")) {
                this.setPropertyId((String) dataMap.get("propertyId"));
            }

            if (dataMap.containsKey("columnNum")) {
                this.setColumnNum(Integer.valueOf((String) dataMap.get("columnNum")));
            }

            if (dataMap.containsKey("dispIndex")) {
                this.setDispIndex(Integer.valueOf((String) dataMap.get("dispIndex")));
            }

            if (dataMap.containsKey("dataStatus")) {
                this.setStatus(Integer.valueOf((String) dataMap.get("dataStatus")));
            }

            if (dataMap.containsKey("createUser")) {
                this.setCreateUser((String) dataMap.get("createUser"));
            }

            if (dataMap.containsKey("updateUser")) {
                this.setUpdateUser((String) dataMap.get("updateUser"));
            }

            if (dataMap.containsKey("createTime")) {
                this.setCreateTime(Long.valueOf("0" + (String) dataMap.get("createTime")));
            }

            if (dataMap.containsKey("updateTime")) {
                this.setUpdateTime(Long.valueOf("0" + (String) dataMap.get("updateTime")));
            }
            //是否行合并单元格
            if (dataMap.containsKey("isMerge")) {
                this.setIsMerge(String.valueOf(dataMap.get("isMerge")));
            }
            if(dataMap.containsKey("fieldLen")){
                this.setFieldLen(String.valueOf(dataMap.get("fieldLen")));
            }
            if(dataMap.containsKey("fieldType")){
                this.setFieldType(String.valueOf(dataMap.get("fieldType")));
            }
            if(dataMap.containsKey("fieldEmpty")){
                this.setFieldEmpty(String.valueOf(dataMap.get("fieldEmpty")));
            }
        }
    }

    public String getSchemeId() {
        return schemeId;
    }

    public void setSchemeId(String schemeId) {
        this.schemeId = schemeId;
    }

    public String getPropertyId() {
        return propertyId;
    }

    public void setPropertyId(String propertyId) {
        this.propertyId = propertyId;
    }

    public int getColumnNum() {
        return columnNum;
    }

    public void setColumnNum(int columnNum) {
        this.columnNum = columnNum;
    }

    public int getDispIndex() {
        return dispIndex;
    }

    public void setDispIndex(int dispIndex) {
        this.dispIndex = dispIndex;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public String getPropertyTitle() {
        return propertyTitle;
    }

    public void setPropertyTitle(String propertyTitle) {
        this.propertyTitle = propertyTitle;
    }

    public String getIsMerge() {
        return isMerge;
    }

    public void setIsMerge(String isMerge) {
        this.isMerge = isMerge;
    }

}
